import { createBrowserRouter } from 'react-router-dom'
import { lazy } from 'react'
import App from '../App'

// 一级路由
const Home = lazy(() => import('../pages/home/Index'));

// 二级路由
const Index = lazy(() => import('../pages/index/Index'));
const Class = lazy(() => import('../pages/class/Index'));

// 二级路由
export const homeTwo = [
    {
        path: '/home/index',
        element: <Index></Index>,
        title: '首页'
    },
    {
        path: '/home/class',
        element: <Class></Class>,
        title: '分类'
    },
]

// 一级路由及重定向
const router = createBrowserRouter([{
    path: '/',
    element: <App></App>,
    children: [
        {
            index: true,
            element: <Home></Home>
        },
        {
            path: '/home',
            element: <Home></Home>,
            children: homeTwo
        }
    ]
}])



export default router